{include file="publics/head"/}
<link rel="stylesheet" href="__PUBLIC__/webuploader-0.1.5/xb-webuploader.css">

<body class="no-skin">
{include file="publics/header"/}
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    {include file="publics/sidebar"/}
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            {include file="publics/breadcrumbs"/}

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                {include file="publics/set"/}

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                       <div id="uploader" class="wu-example">
						    <!--用来存放文件信息-->
						    <div id="thelist" class="uploader-list"></div>
						    <div class="btns">
						        <div id="picker">选择文件</div>
						        <button id="ctlBtn" class="btn btn-default">开始上传</button>
						    </div>
						</div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    {include file="publics/footer"/}

</div><!-- /.main-container -->

{include file="publics/footerjs"/}
<!-- inline scripts related to this page -->

<!-- icon选择插件begin -->
    <script src="/Public/icon_select/jquery.fonticonpicker.js"></script>
    <link href="/Public/icon_select/css/jquery.fonticonpicker.css" rel="stylesheet" />
    <link href="/Public/icon_select/themes/grey-theme/jquery.fonticonpicker.grey.css" rel="stylesheet" />
    <link href="/Public/icon_select/themes/dark-grey-theme/jquery.fonticonpicker.darkgrey.css" rel="stylesheet" />
    <link href="/Public/icon_select/themes/bootstrap-theme/jquery.fonticonpicker.bootstrap.css" rel="stylesheet" />
    <link href="/Public/icon_select/themes/inverted-theme/jquery.fonticonpicker.inverted.css" rel="stylesheet" />
    <link href="/Public/icon_select/fontello-7275ca86/css/fontello.css" rel="stylesheet" />
    
    <script src="//cdn.staticfile.org/webuploader/0.1.5/webuploader.min.js"></script>
<!-- icon选择插件end -->

<script type="text/javascript">
var BASE_URL = '__PUBLIC__/webuploader-0.1.5';
var uploader = WebUploader.create({

    // swf文件路径
    swf: BASE_URL + '/js/Uploader.swf',

    // 文件接收服务端。
    server: 'http://webuploader.duapp.com/server/fileupload.php',

    // 选择文件的按钮。可选。
    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
    pick: '#picker',

    // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
    resize: false
});

    $(function () {
    	var editor = KindEditor.create('textarea[name="tips"]', {
            resizeType: 1,
            allowPreviewEmoticons: false,
            allowImageUpload: false,
            items: [
                'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                'insertunorderedlist', '|', 'emoticons', 'link']
        });	
        
        $(".submit").click(function () {
        	var jsonData = {
        		'title' : $("#title").val(),
        		'name' : $("#name").val(),
        		'tips' : editor.html(),
        	}
        	console.log(jsonData)
        	$.ajax({
    			type: "post",
    			url: "{:url('Other/sendEmail')}",
    			dataType: 'JSON',
    			data: jsonData,
    			error: function () {
    				return false;
    			},
    			success: function (data) {
    				bootbox.alert({  
                        buttons: {  
                           ok: {label: '确定',className: 'btn-danger'}  
                        },  
                        message: data,  
                        callback: function() {  
                          	//location.reload(); 
                        },  
                        title: "系统提示",  
                    });
    			}
    		});
        	
        })

    })
</script>

</body>
</html>
